﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Xml;
using SharpObjects.Configuration;
using SharpObjects.Configuration.ConfigurationProviders;
using SharpObjects.Interfaces;
using SharpObjects.RuleEngine;

namespace SharpObjects.RuleEngine.RuleElements
{
    public class ListOfRulesElement : IXmlInitializable
    {
        public IRule[] Rules { get; set; }

        #region IInitializable Members

        public void Initialize(XmlElement initializationElement)
        {
            XmlConfigurationProvider init = new XmlConfigurationProvider(initializationElement);

            Rules = init.GetObjects<IRule>("child::*");

            this.IsInitialized = true;
        }

        public bool IsInitialized { get; set; }

        #endregion
    }
}
